package sk.vrto.web.events;

import sk.vrto.domain.Contact;
import sk.vrto.web.presenters.ContactPresenter;

/**
 * Should be fired when contact is updated.
 */
public class ContactUpdatedEvent {

    private final Contact updatedContact;
    private final ContactPresenter presenterForNewView;

    /**
     * @param updatedContact Contact that was updated
     * @param presenterForNewView Original presenter for a contact view.
     *                            Might be necessary, when view is deleted and added immediately
     *                            right after that.
     */
    public ContactUpdatedEvent(Contact updatedContact, ContactPresenter presenterForNewView) {
        this.updatedContact = updatedContact;
        this.presenterForNewView = presenterForNewView;
    }

    public Contact getUpdatedContact() {
        return updatedContact;
    }

    public ContactPresenter getPresenterForNewView() {
        return presenterForNewView;
    }

    @Override
    public String toString() {
        return "ContactUpdatedEvent{" +
                "updatedContact=" + updatedContact +
                ", presenterForNewView=" + presenterForNewView +
                '}';
    }

}
